<!--conf
<sample in_favorites="true">
              <product version="1.5" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               <sampledescription><![CDATA[dhtmlxTree supports standard keys for navigating data in tree and editing items. Also, you can set your own key maps.]]></sampledescription></sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>

	<title> Navigation and Edit with keyboard</title>

</head>

<body>
	<h1>Navigation and Edit with keyboard</h1>
	<p>
There is the possibility to enable keyboard navigation using the enableKeyboardNavigation() method.<br/> You can use default keys or set own keys. Try to assign new keys and then press 8 or 2 key to move up/down, 6 or 4 to open/close, 8 to call function for selected item. 
	<br/>
	There are also some keys for editing:<br/> 
	 - Press F2 to edit selected item<br/> 
	 - Press Enter to close editor<br/> 
	 - Use Cursor keys to navigate<br/> 
	</p>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<table>
		<tr>
			<td>
				<div id="treeboxbox_tree" style="width:250px; height:218px;background-color:#f5f5f5;border :1px solid Silver;; overflow:auto;"></div>
			</td>
			<td rowspan="2" style="padding-left:25" valign="top">
				<a href="#" onClick="tree.enableKeyboardNavigation(true);">Enable navigation</a><br>
				<a href="#" onClick="tree.enableKeyboardNavigation(false);">Disable navigation</a><br>
                <a href='#' onclick='tree.assignKeys(extra_keys);'>
                set custom keys - numeric keypad (2,4,5,6,8)
                </a>
                <br>
                <br>
                <b><div id='a_33'></div></b>
			</td>
		</tr>
		<tr>
			<td>
			</td>
		</tr>
	</table>

    
    Select any item in tree and use next keys
        <li>Up arrow - select upper item</li>
        <li>Down arrow - select lower item</li>
        <li>Right arrow - open item</li>
        <li>Left arrow - close item</li>
        <li>Enter - call item's action</li>
		<li>F2 - edit</li>
		<li>Esc - close editor</li>
	<script>

var extra_keys=[["up",104],["down",98],["open",102],["close",100],["call",101]];
if (_isOpera)
	extra_keys=[["up",56],["down",50],["open",54],["close",52],["call",53]];
	
            function m_f(id){
                document.getElementById("a_33").innerHTML=("Item "+id);
            }
			tree=new dhtmlXTreeObject("treeboxbox_tree","100%","100%",0);

			tree.setSkin('dhx_skyblue');
			tree.setImagePath("../../../codebase/imgs/dhxtree_skyblue/");
			tree.enableSmartXMLParsing(true);
            tree.enableItemEditor(true);
			tree.enableDragAndDrop(true);
			tree.enableItemEditor(true);
            tree.enableKeyboardNavigation(true);
			tree.loadXML("../common/tree.xml");
	</script>
<br><br>

</body>
</html>
